import book.BookList;
import user.admin.MainUser;
import user.userer.User;
import user.userer.Ordinary;
import user.userer.Administrator;

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("欢迎来到图书商城");
        System.out.println("请输入姓名：");
        String name = input.next();
        BookList bl = new BookList();
        MainUser b21 = new MainUser();
        b21.login();
        System.out.println("***********************");
        System.out.println("请确认您的身份：");
        System.out.println("1.管理员");
        System.out.println("2.普通用户");
        System.out.println("***********************");
        int a = input.nextInt();
        if(a==1){
            User user = new Administrator(name);
            int choice;
                System.out.println("请输入管理员验证密码：");
                String password1 = input.next();
                String password2 = "123456";
                if(password1.equals(password2))
                {
                    System.out.println("验证成功");
                    while (true) {
                        choice = user.menu();
                        user.doOperation(choice,bl);
                }
            }else{
                    System.out.println("验证失败，请重新选择");
                    b21.login();
                }
        }else if(a==2){
            User user = new Ordinary(name);
            int choice;
            while (true) {
                choice = user.menu();
                user.doOperation(choice,bl);
            }
        }
    }
}